package com.zr.sms.serviceimpl;

import com.zr.sms.dao.EmployeeDao;
import com.zr.sms.daoimpl.EmployeeDaoImpl;
import com.zr.sms.model.Employee;
import com.zr.sms.service.FindEmpService;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

public class FindEmpServiceImpl implements FindEmpService{
	EmployeeDao emp = new EmployeeDaoImpl();
	
	public JSONObject findemps(int start, int pageSize) {
		JSONObject emps = new JSONObject();
		emps.put("total",emp.getEmpsConut());
		emps.put("rows",JSONArray.fromObject(emp.getEmpsByRid(start, pageSize)));
		return emps;
	}
	
	public int addEmpAll(Employee emp) {
		// TODO Auto-generated method stub
		return this.emp.addEmpAll(emp);
	}
	
	public int deleteEmp(String[] eids) {
		// TODO Auto-generated method stub
		return emp.deleteEmp(eids);
	}

	public int addEmp(Employee emp) {
		// TODO Auto-generated method stub
		return this.emp.addEmp(emp);
	}
	
	public int updateEmp(Employee emp) {
		// TODO Auto-generated method stub
		return this.emp.updateEmp(emp);
	}
	
	public JSONObject findemps(int start, int pageSize, String searchname) {
		JSONObject emps = new JSONObject();
		emps.put("total", emp.getEmpsConut(searchname));
		emps.put("rows",JSONArray.fromObject(emp.getEmpsByRid(start, pageSize, searchname)));
		return emps;
	}

}
